How many key/value pairs target currently holds - 0 for an empty map, up to target's own declared capacity once it is full.
map_length(target) -> int| Name | Type |
|---|---|
target | map |
int
How many key/value pairs target currently holds - 0 for an empty map, up to target's own declared capacity (/// @capacity, always a power of two - see map_set) once it is full.
/// @type {map<string,int>}
var scores = {};
map_set(scores, "alice", 10);
map_set(scores, "bob", 20);
var count = map_length(scores); // 2



Just the hash map's size() - O(1).